<?
/*
 * Copyright 2004-2005 Sigve Indregard.
 *
 * This file is part of Laivsys.
 *
 * Laivsys is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Laivsys is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Laivsys; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/*
 * $Id: dokumenter.php 6 2005-07-11 23:14:47Z say $
 */
 
include_once("db.php");
include_once("laivid.php");
include_once("design.php");

$arr=getLaiv();
$arrid=$arr['ID'];
$sidetittel=$arr['Tittel']." - Dokumenter";
include("top.php");

headline("Dokumenter");

if (time > strftime($arr['Roller_release'])) {
	//roller-release er passert
	$sql = "SELECT * FROM Dokumenter WHERE LaivID=$arrid AND (Offentlig=1 OR Offentlig_etterlaiv=1)";
	$dokumenter = mysql_query($sql);
} else {
	//roller-release er ikke passert
	$sql = "SELECT * FROM Dokumenter WHERE LaivID=$arrid AND Offentlig=1";
	$dokumenter = mysql_query($sql);
}

if (mysql_num_rows($dokumenter)) {
	$tekst="<table class=\"liste\">\n";
	while ($dok = mysql_fetch_assoc($dokumenter)) {
		$sz = (float)$dok['str'];
		$szstr=round($sz/1024, 2);
		$tekst .= "<tr>\n";
		$tekst .= "<td>".$dok['beskrivelse']."</td>\n";
		$tekst .= "<td>$szstr kB</td>\n";
		$tekst .= "<td><a href=\"nettsvar_lastned.php?id={$dok['ID']}\">[last ned]</a></td>\n";
		$tekst .= "</tr>\n";
	}
	$tekst.="</table>\n";
} else {
	$tekst="<p>Ingen tilgjengelige dokumenter for denne laiven.</p>\n";
}

text($tekst, false);	

include("bottom.php");
?>
